home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / gui / gtldv374.lha / GadUtil / Docs / AutoDocs / 12.GU_CoordsInGadBox < prev    next >
Text File  |  1996-05-14  |  2KB  |  60 lines

  1. gadutil.library/GU_CoordsInGadBox           gadutil.library/GU_CoordsInGadBox
  2.  
  3.    NAME
  4.     GU_CoordsInGadBox -- Check if a coordinate pair is within a gadget.
  5.  
  6.    SYNOPSIS
  7.     IsInBox = GU_CoordsInGadBox(coords, gad)
  8.     D0,SR(Z)                    D0      A0
  9.  
  10.     BOOL GU_CoordsInGadBox(ULONG, struct Gadget *);
  11.  
  12.    FUNCTION
  13.     Check if a coordinate pair is within a gadget's border. This
  14.     function may be used to make coordinate sensitive AppWindows
  15.     (allows the user to drop a file on a string gadget etc.).
  16.     To use this function, you must save the coordinates from the
  17.     recieved message (AppMessage, IntuiMessage) to have something
  18.     to compare against.
  19.  
  20.    INPUTS
  21.     coords - a combined LONG of both the X and Y coordinates to
  22.          compare against. The X coordinate should be in the
  23.          upper word of the parameter.
  24.  
  25.     gad - the gadget to check the coordinates against.
  26.  
  27.    RESULT
  28.     IsInBox - TRUE if both given coordinates was within the gadget's
  29.           outer box (X coord is between gadx and gadx+gadw,
  30.           Y coord is between gady and gady+gadh). Otherwise this
  31.           function will return FALSE.
  32.  
  33.    EXAMPLES
  34.     Assembly language:
  35.         move.l    am_MouseX(a0),d0    ; Get X and Y coordinates
  36.         move.l    mystrgad(pc),a0
  37.         move.l    GadUtilBase(pc),a6
  38.         jsr    _LVOGU_CoordsInGadBox(a6)
  39.         beq.b    .notinbox        ; Not in gadget box
  40.     
  41.         ; Do what you want to do if the coordinates are
  42.         ; within the gadget box
  43.     .notinbox:
  44.         ; Here, you may want to check for some other gadgets
  45.  
  46.  
  47.     C:
  48.         long coords;
  49.         coords = (LONG)appmsg->MouseX << 16 | appmsg->MouseY;
  50.         if (CoordsInGadBox(coords,mystrgad) = TRUE)
  51.         {
  52.             /* Do what you want to do if the coordinates
  53.                are within the gadget box */
  54.         }
  55.         else
  56.         {
  57.             /* Here, you may want to check for some other
  58.                gadgets */
  59.         }
  60.